﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Manager.Master" AutoEventWireup="true" CodeBehind="CategoryManager.aspx.cs" Inherits="Bilyteam_Website.Admin.CategoryManager" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
       <ContentTemplate>
     <center>
     <div style="margin-top:50px">
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
            AllowSorting="True" AutoGenerateColumns="False" BackColor="#CCFF99" 
            BorderColor="#999999" BorderWidth="1px" DataKeyNames="CategoryID" 
            DataSourceID="SqlDataSource1" EnableModelValidation="True" Width="913px">
            <Columns>
                <asp:BoundField DataField="CategoryID" HeaderText="CategoryID" 
                    InsertVisible="False" ReadOnly="True" SortExpression="CategoryID" />
                <asp:BoundField DataField="CategoryName" HeaderText="CategoryName" 
                    SortExpression="CategoryName" />
                <asp:BoundField DataField="Link" HeaderText="Link" SortExpression="Link" />
                <asp:BoundField DataField="Parrent" HeaderText="Parrent" 
                    SortExpression="Parrent" />
                <asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" />
                <asp:CommandField ShowEditButton="True" />
                <asp:CommandField ShowDeleteButton="True" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
             ConnectionString="<%$ ConnectionStrings:PROJECT %>" 
             SelectCommand="SELECT * FROM [Categories] WHERE ([Status] = @Status)"
             DeleteCommand="DELETE FROM [Categories] WHERE [CategoryID] = @CategoryID"
             UpdateCommand="UPDATE [Categories] SET [CategoryName] = @CategoryName, [Link] = @Link, [Parrent] = @Parrent, [Type] = @Type WHERE [CategoryID] = @CategoryID">
        <DeleteParameters>
            <asp:Parameter Name="CategoryID" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="CategoryName" Type="String" />
            <asp:Parameter Name="Link" Type="String" />
            <asp:Parameter Name="Parrent" Type="Int32" />
            <asp:Parameter Name="Type" Type="Int32" />
            <asp:Parameter Name="CategoryID" Type="Int32" />
        </UpdateParameters>
        <SelectParameters>
             <asp:Parameter DefaultValue="1" Name="Status" Type="Int32" />
        </SelectParameters>
        </asp:SqlDataSource>
        <br />
        <br />
     <div style="width:337px">
        <table id="Table" style="width: 100%; height: 94px;">
            <tr>
                <td class="style2">
                    <asp:Label ID="lbCategoryName" runat="server" Text="CategoryName"></asp:Label>
                &nbsp;:</td>
                <td>
                    <asp:TextBox ID="txtCategoryName" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    <asp:Label ID="lbLink" runat="server" Text="Link"></asp:Label>
                &nbsp;:</td>
                <td>
                    <asp:TextBox ID="txtLink" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style3">
                    <asp:Label ID="Parrent" runat="server" Text="Parrent"></asp:Label>
                &nbsp;:</td>
                <td class="style1">
                    <asp:DropDownList ID="ddlParrent" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="style3">
                    <asp:Label ID="lbType" runat="server" Text="Type"></asp:Label>
                &nbsp;:</td>
                <td class="style1">
                    <asp:DropDownList ID="ddlType" runat="server">
                        <asp:ListItem>1</asp:ListItem>
                        <asp:ListItem>2</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="style3">
                    <asp:Button ID="btInsert" runat="server" onclick="btInsert_Click" 
                        Text="Insert" />
                </td>
                <td class="style1">
                    <asp:Button ID="btCancel" runat="server" Text="Cancel" 
                        onclick="btCancel_Click" />
                </td>
            </tr>
            <tr>
               <td>
                   <asp:Label ID="lbTest" runat="server" ForeColor="Red"></asp:Label>
               </td>
            </tr>
        </table>
      </div>
    </div>
  </center>
  </ContentTemplate>
 </asp:UpdatePanel>
</asp:Content>
